@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @if(isset($search_tpl))
        {{$search_tpl->render()}}
    @endif
    @component('backend::component.table.table-content')
        @slot('page_title'){{$page_title}}@endslot
        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 清理广告位 @endslot
                @slot('color') danger @endslot
                @slot('icon') hcl-clear @endslot
                @slot('class') btn-ajax @endslot
                @slot('params')
                    {"url":"{{route('b_ShopAd_clearAdPos')}}","method":"get","title":"清理广告位","confirm":"true"}
                @endslot
            @endcomponent
        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <table class="table table-striped table-bordered">
                    <thead><tr>
                        <th>
                            @component('backend::component.checkbox')
                                @slot('name') ids-all @endslot
                            @endcomponent
                        </th>
                        <th>位置名称</th><th>位置大小</th><th>可放广告数量</th><th>详情</th><th>终端类型</th><th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $value)
                        <tr>
                            <td>
                                @component('backend::component.checkbox')
                                    @slot('name') id[] @endslot
                                    @slot('class') id @endslot
                                    @slot('value') {{$value->id}} @endslot
                                @endcomponent
                            </td>
                            <td>{{$value->pos_name}}</td>
                            <td>
                                宽:{{$value->ad_width}},高{{$value->ad_height}}
                            </td>
                            <td>{{$value->ad_number}}</td>
                            <td>
                                @component('backend::component.a')
                                    @slot('title') 广告列表({{$value->use_number}}) @endslot
                                    @slot('class') text-primary @endslot
                                    @slot('href') {{route('b_ShopAd_index',['pos_id'=>$value->id])}} @endslot
                                @endcomponent
                            </td>
                            <td>{{config('app.client_type')[$value->client_type]}}</td>
                            <td>
                                @if($value->use_number<$value->ad_number)
                                    @component('backend::component.form.button')
                                        @slot('elem') a @endslot
                                        @slot('title') 添加广告 @endslot
                                        @slot('icon') hcl-img-upload @endslot
                                        @slot('size') sm @endslot
                                        @slot('color') info @endslot
                                        @slot('href') {{route('b_ShopAd_create',['pos_id'=>$value->id])}} @endslot
                                    @endcomponent
                                @else
                                    该广告位已满
                                @endif
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                @slot('list_page')
                    {{$list->appends($search_tpl->getSearchData())->links('backend::public.pagination')}}
                @endslot
            @else
                @component('backend::public.empty_page')
                    @slot('info') 暂时没有广告位 @endslot
                @endcomponent
            @endif
        @endslot
    @endcomponent
@endsection